<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表白墙</title>
    <script src="jquery.min.js"></script>
</head>
    <style>
    * {
        margin: 0;
        padding: 0;
}

    .container {
        width: 400px;
        margin: 0 auto;
}

    h1 {
        text-align: center;
        padding: 20px 0;
}

    p {
        color: #666;
        text-align: center;
        font-size: 14px;
        padding: 10px 0;
}

    .row {
        height: 40px;
        display: flex;
        justify-content: center;
        align-items: center;
}
    span {
        width: 100px;
        line-height: 40px;
}

    .edit {
        width: 200px;
        height: 30px;
}

    .submit {
        width: 304px;
        height: 40px;
        color: white;
        background-color: orange;
        border: none;
}
    </style>
    <body>
    <div class="container">
            <h1>表白墙</h1>
            <p>输入后点击提交</p>

        <div class="row">
            <span>谁：</span>
            <input type="text" class="edit">
        </div>

        <div class="row">
            <span>对谁说:</span>
            <input type="text" class="edit">
        </div>
        
        <div class="row">
            <span>说什么</span>
            <input type="text" class="edit">

        </div >
        
        <div class="row">
            <input type="button" value="提交" class="submit">
        </div>
    </div>
    <script>
        $(function(){
            $(".submit").click(function(){
                var from=$('.edit:eq(0)').val();
                var to=$('.edit:eq(1)').val();
                var message=$('.edit:eq(2)').val();
                console.log(from+"对"+to+"说"+message);
                if(from == ''|| to =='' || message == ''){
                    return;
                }
                var html = '<div class="row">'+ from +'对' + to +'说'+ message + '<div>';
                $('.container').append(html);
                $(".text").val("");
            });
        });
    </script>
    </body>
</html>